/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Jiang Jinxi
 * Date: 2024-04-09
 * Time: 8:52
 */
public class Test2 {
    public static boolean isPrime(int n,int[] arr,int count){
        for (int i = 0; i < count; i++) {
            if(arr[i] > Math.sqrt(n)){
                break;
            }
            if(n % arr[i] == 0){
                return false;
            }
        }
        return true;
    }

    public static void main(String[] args) {
        int[] arr = new int[50];
        arr[0] = 2;
        int usedSize = 1;
        int n = 3;
        while(usedSize < 50){
            if(isPrime(n,arr,usedSize)){
                arr[usedSize] = n;
                usedSize++;
            }
            n++;
        }
        for (int i = 0; i < usedSize; i++) {
            System.out.print(arr[i] + " ");
        }
    }
}
